// const BASE_URL = 'http://localhost:8082'
const BASE_URL = 'http://140.143.244.192:8082'
export const myRequest = (options)=>{
	console.log("api--->option:",options);
	console.log("api--->option.method:",options.method);
	console.log("api--->option.data:",options.data);
	// if (typeof(options.method) == "undefined"){}
	return new Promise((resolve,reject)=>{
		uni.request({
			url:BASE_URL+options.url,
			
			method: options.method || 'GET',
			data: options.data || {},
			success: (res)=>{
				console.log("res.data-(api.js)->",res.data);
				if(res.data.status != 0) {
					return uni.showToast({
						title: '获取数据失败'
					})
				}
				resolve(res)
			},
			fail: (err)=>{
				// uni.showToast({
				// 	title: '请求接口失败'
				// })
				reject(err)
			}
		})
	})
}